//
//  WYCmypolicyViewController.m
//  掌上还
//
//  Created by 王晓民 on 2018/1/13.
//  Copyright © 2018年 中企互联. All rights reserved.
//

#import "WYCmypolicyViewController.h"
@interface WYCmypolicyViewController ()<UIWebViewDelegate>
@property (nonatomic,strong)UIWebView *policyWebView;

@end

@implementation WYCmypolicyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupNav];
    [SVProgressHUD showWithStatus:@"加载中..."];

    _policyWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, NavHeight, ScreenWidth, ScreenHeight - 44)];
    
    NSString *chinese = @"资金账户安全";
    
    NSString *encodeStr = [chinese stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    
    NSLog(@"wqc====%@", encodeStr);
    NSString * str = [NSString stringWithFormat:@"http://zheb.cic.cn:8894/module/product/general-view/main.html?bizKey=081K&isFShare=1&cBranchcode=37&userId=37030747&tagId=0&owner=2118927&isMe=0&productCode=081K&desc=%@#/consumerInfo",encodeStr];

    NSLog(@"wqc=======%@",str);
    
    NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:str]];
    [SVProgressHUD dismiss];

    [self.view addSubview: _policyWebView];
    
    [_policyWebView loadRequest:request];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//Nav字体颜色+ 背景
- (void)setupNav {
    self.navigationItem.title = @"我的保单";
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
    [self.navigationController.navigationBar setBarTintColor:wycMain];
}

- (void)viewWillAppear:(BOOL)animated {
    
    [super viewWillAppear:animated];
    
    
    
    self.navigationController.navigationBar.hidden = YES;
    
    
    UIView * NavView = [[UIView alloc] init];
    NavView.frame = CGRectMake(0, 0, ScreenWidth, NavHeight);
    NavView.backgroundColor = WYCMain;
    [self.view addSubview:NavView];
    
    
    
    CALayer *bottomLineLayer = [[CALayer alloc] init];
    bottomLineLayer.frame = CGRectMake(0, NavView.bounds.size.height - 0.5, NavView.bounds.size.width, 0.5);
    bottomLineLayer.backgroundColor = WYCRGBColor(191, 191, 196).CGColor;
    [NavView.layer addSublayer:bottomLineLayer];
    
    
    
    
    
    //返回按钮
    UIButton *  fanhuibutton = [[UIButton alloc] init];
    [fanhuibutton setImage:[UIImage imageNamed:@"Nav_back"] forState:UIControlStateNormal];
    [fanhuibutton addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
    fanhuibutton.frame = CGRectMake(30 * px, titleY, 66 * px , 66 * px);
    [NavView addSubview:fanhuibutton];
    
    
    UILabel * NavRigsterLabel = [[UILabel alloc] init];
    NavRigsterLabel.frame = CGRectMake(0, titleY, NavView.width, 68 * px);
    NavRigsterLabel.textColor = [UIColor whiteColor];
    NavRigsterLabel.font = [UIFont boldSystemFontOfSize:BigFont];
    NavRigsterLabel.textAlignment = NSTextAlignmentCenter;
    NavRigsterLabel.text = @"我的保单";
    [NavView addSubview:NavRigsterLabel];
}
- (void)backClick{
    
    [self.navigationController popViewControllerAnimated:YES];
}


@end
